# split 方法,可以指定分隔符,放到list里
# 逆序
# 组合

# def reversewords(s: str):
#     tokens = s.split(' ')
#     tokens.reverse()
#     return ' '.join(tokens)
#
# print(reversewords('i am a student'))


# 旋转字符串
def rotatestring(s, goal):
    if len(s) != len(goal):
        return False
    return goal in (s + s)

# print(rotatestring("abcde", "cdeab"))
# print(rotatestring("abcde", "edcba"))

# 统计字符串前缀
# Startwith

def counterfixes(words: list, s: str):
    count = 0
    for word in words:
        if s.startswith(word):
            # s是以word开头
            count += 1
    return count


print(counterfixes(['a', 'b', 'c', 'ab', 'abc'], 'abc'))
print(counterfixes(['a', 'a'], 'aa'))

